package models

import "gorm.io/gorm"

type Good struct {
	gorm.Model
	Title  string  `gorm:"type:varchar(150);not null;commit:'标题'"`
	Price  float64 `gorm:"type:decimal(10,2);not null;commit:'价格'"`
	Stock  int64   `gorm:"type:int;not null;commit:'库存"`
	Image  string  `gorm:"type:int;not null;commit:'图片'"`
	Status int64   `gorm:"type:int;default:0;commit:'商品状态:0-上架,1-下架'"`
}

func (g *Good) Detail() error {
	return DB.Where("status=0").First(&g).Error
}
